﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Collections;
using log4net;
using WEB.BLL.Entities;
using WEB.Exceptions;

namespace WEB.BLL.Services
{
    #region ScreenService

    /// <summary>
    /// ScreenService object for Ibatis mapped table 'Screen'.
    /// </summary>
    public class DashboardService : IDashboardService
    {
        private static readonly ILog log = LogManager.GetLogger(typeof(DashboardService).Name);
        private static volatile DashboardService _DashboardService = null;
        public static DashboardService GetInstance()
        {
            if (_DashboardService == null)
            {
                lock (typeof(DashboardService))
                {
                    if (_DashboardService == null) // double-check
                        _DashboardService = new DashboardService();
                }
            }
            return _DashboardService;
        }
        public DashboardService()
        {
            //
            // TODO: Add constructor logic here
            //
        }
        public int UpdateEx(DashboardEntity objE)
        {
            try
            {
                ExecuteUpdate("DashboardUpdateEx", objE);
                return 1;
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                throw new DBException(ex.Message, ex);
            }
        }
        public int DeleteRow(DashboardEntity objE)
        {
            try
            {
                ExecuteUpdate("DashboardDeleteRow", objE);
                return 1;
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                throw new DBException(ex.Message, ex);
            }
        }
        public int InsertRow(DashboardEntity objE)
        {
            try
            {
                ExecuteUpdate("DashboardInsertRow", objE);
                return 1;
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                throw new DBException(ex.Message, ex);
            }
        }
        public int ChangeRow(DashboardEntity objE)
        {
            try
            {
                ExecuteUpdate("DashboardChangeRow", objE);
                return 1;
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                throw new DBException(ex.Message, ex);
            }
        }
        public int PermutationRow(DashboardEntity objE)
        {
            try
            {
                ExecuteUpdate("DashboardPermutationRow", objE);
                return 1;
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                throw new DBException(ex.Message, ex);
            }
        }
    }
    #endregion
}
